package com.bodu.depress.controller;

import com.bodu.client.DepressCollectClient;
import com.bodu.core.entity.result.Result;
import com.bodu.depress.entity.DepressCollectDataVo;
import com.bodu.depress.entity.request.DepressCollectResultRequest;
import com.bodu.depress.entity.vo.DepressCollectResultVo;
import com.bodu.depress.entity.vo.DepressCollectVo;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 题集管理
 */
@RestController
@RequestMapping("/api/depress-collect")
public class DepressCollectApiController {

    @Autowired
    private DepressCollectClient depressCollectClient;

    @ApiModelProperty("得到可用的题集")
    @PostMapping("findDepressCollects")
    public Result<List<DepressCollectDataVo>> findDepressCollects() {
        return depressCollectClient.findDepressCollects();
    }

    /**
     * 得到结果集
     * @return
     */
    @ApiModelProperty("得到可用的题集")
    @PostMapping("findDepressResult")
    public Result<DepressCollectResultVo> findDepressResult(@RequestBody DepressCollectResultRequest request) {
        return depressCollectClient.findDepressResult(request);
    }

    @ApiModelProperty("题集")
    @GetMapping("/findDepressCollectById/{id}")
    public Result<DepressCollectVo> findDepressCollectById(@PathVariable("id") Long id) {
       return depressCollectClient.findDepressCollect(id);
    }
}
